package ch04;

/**
 * Created by 其 on 2016/3/20.
 */
class Clothe {
    String color;
    char size;
    Clothe(String color, char size) {
        this.color = color;
        this.size = size;
    }
}

public class DeepCopy {
    public static void main(String[] args) {
        Clothe[] c1 = {new Clothe("red", 'L'), new Clothe("blue", 'M')};
        Clothe[] c2 = new Clothe[c1.length];
        for(int i = 0; i < c1.length; i++) {
            Clothe c = new Clothe(c1[i].color, c1[i].size);
            c2[i] = c;
        }
        c1[0].color = "yellow";
        System.out.println(c2[0].color);
    }
}
